Trò chơi Angry Birds trong UNITY Engine
31.724 lượt xem;
1 using System;
2
3
4 public static class GoEaseCircular
5 {
6 public static float EaseIn( float t, float b, float c, float d )
7 {
8 return -c * ( (float)Math.Sqrt( 1 - ( t /= d ) * t ) - 1 ) + b;
9 }
10
11 public static float EaseOut( float t, float b, float c, float d )
12 {
13 return c * (float)Math.Sqrt( 1 - ( t = t / d - 1 ) * t ) + b;
14 }
15
16 public static float EaseInOut( float t, float b, float c, float d )
17 {
18 if( ( t /= d / 2 ) < 1 )
19 {
20 return -c / 2 * ( (float)Math.Sqrt( 1 - t * t ) - 1 ) + b;
21 }
22 return c / 2 * ( (float)Math.Sqrt( 1 - ( t -= 2 ) * t ) + 1 ) + b;
23 }
24 }
2
3
4 public static class GoEaseCircular
5 {
6 public static float EaseIn( float t, float b, float c, float d )
7 {
8 return -c * ( (float)Math.Sqrt( 1 - ( t /= d ) * t ) - 1 ) + b;
9 }
10
11 public static float EaseOut( float t, float b, float c, float d )
12 {
13 return c * (float)Math.Sqrt( 1 - ( t = t / d - 1 ) * t ) + b;
14 }
15
16 public static float EaseInOut( float t, float b, float c, float d )
17 {
18 if( ( t /= d / 2 ) < 1 )
19 {
20 return -c / 2 * ( (float)Math.Sqrt( 1 - t * t ) - 1 ) + b;
21 }
22 return c / 2 * ( (float)Math.Sqrt( 1 - ( t -= 2 ) * t ) + 1 ) + b;
23 }
24 }